package com.dueeeke.videoplayer.aplayer;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.ViewGroup;

import com.dueeeke.videoplayer.player.VideoView;

public class AVideoView extends VideoView {
    public AVideoView(Context context) {
        super(context);
    }

    public AVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public AVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void addDisplay() {
        //super.addDisplay();
    }

    @Override
    protected void setOptions() {
        super.setOptions();
        if (mRenderView != null) {
            mPlayerContainer.removeView(mRenderView.getView());
            mRenderView.release();
        }
        mRenderView = mRenderViewFactory.createRenderView(getContext());
        mRenderView.attachToPlayer(mMediaPlayer);
        LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER);
        mPlayerContainer.addView(mRenderView.getView(), 0, params);
    }
}
